#ifndef GAMEPANELBUTTON_H
#define GAMEPANELBUTTON_H

#include <QtCore>
#include <QtGui>

class GamePanel;

class GamePanelButton : public QGraphicsWidget
{
    Q_OBJECT
public:
    GamePanelButton(const QPixmap & pixmap, QGraphicsItem * parent = 0);
    QRectF boundingRect() const;
    inline void setCanToggled(bool value) {m_canToggle = value;}
private:
    QPixmap m_pixmap;
    bool    m_hovered;
    bool    m_isToggled;
    bool    m_canToggle;
protected:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
signals:
    void toggled(bool);
    void pressed();
    void rightClicked();
public slots:
    void setToggled(bool value);
};

#endif // GAMEPANELBUTTON_H
